clear all
set more off

global data 	"R:\SharedProjects\Shared2020-070\2016\extend_to_2020\JPE_Replication_dta"
global do	 	"R:\SharedProjects\Shared2020-070\2016\extend_to_2020\JPE_Replication_do"

cd $data

****SAMPLE CONSTRUCTION
do $do\A_more_hlthlm_measures.do			/*Additional health variables from row HRS data*/
do $do\B_merge_income_and_f831.do			/*Merge admin income data and F831 records*/
do $do\C_merge_with_rand.do					/*Merge with HRS Rand*/
do $do\D_merge_with_rand_2_12.do			/*Same as above but takes period -2 to 12*/
do $do\E_create_rejection_data.do			/*Create files to be used for structural estimation and reduced form analyses*/
do $do\F_create_vignette_data.do			/*Create vignette data*/
do $do\G_create_redform_samples.do			/*Create files to be used for reduced form analyses*/
****REDUCED FORM RESULTS		
do $do\H_redform_estimation.do				/*Reduced form results*/
****STRUCTURAL ESTIMATION RESULTS
do $do\J_structural_estimation.do			/*Moments for structural estimation*/	
do $do\K_bootstrap_se.do					/*Create boostrap cov matrix*/
do $do\L_alpha_estimation.do				/*Get estimate of alpha */
***Run MD_EWMD.R and MD_DWMD.R on R			/*Run two R files outside of stata*/	
do $do\Q_structural_estimation_nonlinR.do	/*Structural estimation for Table OA.6*/

****COUNTERFACTUAL AND THEORETICAL FIGURES/TABLES
do $do\M_counterfactuals.do					/*Tables 8,9,11*/
do $do\N_Figure_Appx_theory.do				/*Figures 3, OA2*/
do $do\P_Theory_Type2_errors.do				/*Figure OA3*/
do $do\R_cleaning.do						/*Wrapping up, erase non-essential files*/

